var maintenanceTitle = ['设备名称', '设备类型', '设备编号', '状态', '维保周期', '上次维保日期', '应维保日期', '下次维保日期'];
var maintenanceLabel = ['name', 'deviceType', 'sn', 'status', 'cycle', 'lastMaintenance', 'maintenanceDate', 'nextMaintenance'];
const prefix = "check/min";
const suffix = ".png";
const textLength = 5;
const pageSize = 5;
var toPage;
$(function () {
    loadDeviceType($('#deviceType-select'));
    loadEnterprise();
    loadMaintenanceData();
    loadMaintenanceList();
    formValidation();
    chart_pie1.setOption(option_pie);
    chart_pie2.setOption(option_pie);
    chart_pie2.setOption({
        color: ['#F8DD83', '#0096FF', '#5DDF91', '#FF7931', '#718BF3',],
        legend: {
            top: 'bottom',
            icon: 'rect',
            itemHeight: 16,
            itemWidth: 16,
            itemGap: 16,
            //width: 340,
            padding: [0, 0],
            textStyle: {
                color: 'rgba(51,51,51,0.6)',
                fontSize: 16,
                padding: [0, 5]
            }
        },
        series: [{
            center: ['50%', '42%'],
            data: [
                {value: 0, name: '定保'},
                {value: 0, name: '一级保养'},
                {value: 0, name: '二级保养'},
                {value: 0, name: '预防性维修'},
                {value: 0, name: '故障维修'}
            ]
        }]
    });
});
var chart_pie1 = echarts.init(document.getElementById('chart_pie1'));
var chart_pie2 = echarts.init(document.getElementById('chart_pie2'));//维保记录
var option_pie = {
    color: ['#0096FF', '#5DDF91', '#F8DD83', '#F95959', '#FF7931'],
    tooltip: {
        trigger: 'item',
        formatter: '{a} <br/>{b} : {c} ({d}%)'
    },
    series: [{
        name: '设备数量',
        type: 'pie',
        radius: [62, 86],
        center: ['50%', '50%'],
        label: {
            formatter: '{b}:{c}次',
            color: '#333'
        },
        labelLine: {
            length: 10,
            length2: 0
        },
        data: [
            {value: 0, name: '应维保'},
            {value: 0, name: '已维保'},
            {value: 0, name: '待维保'},
            {value: 0, name: '已延期'},
            {value: 0, name: '延期保养'}
        ]
    }]
};


$("#validationCustom01").change(function () {
    $('#deviceName_id').val('');
    let sn = $("#validationCustom01").val();
    if (!isNull(sn)) {
        getJson("/device/getDeviceBySn", {sn: sn, type: 1}, 'GET', function (data) {
            $('#deviceName_id').val(data['name']);
        })
    }
});

function formValidation() {
    $('#addInfoForm').bootstrapValidator({
        feedbackIcons: {
            valid: 'fa fa-check',

            validating: 'fa fa-sync-alt'
        },
        fields: {
            sn: {
                validators: {
                    notEmpty: {},
                    stringLength: {
                        min: 2,
                        max: 25
                    },
                    regexp: {
                        regexp: /^[a-zA-Z0-9_]+$/,
                        message: '设备编号只能由字母、数字和下划线组成'
                    },
                    threshold: 2, //设置4字符以上开始请求服务器
                    //有待验证，备注以备下次使用。
                    //bootstrap的remote验证器需要的返回结果一定是json格式的数据 :
                    //{"valid":false} //表示不合法，验证不通过
                    //{"valid":true} //表示合法，验证通过
                    remote: {//发起Ajax请求。
                        url: '../device/verificationDeviceByNumber',//验证地址
                        data: {'sn': $('input[name="sn"]').val(), 'type': 1},
                        message: '未查询到设备信息',//提示消息
                        delay: 50,//设置2秒发起名字验证
                        type: 'POST' //请求方式
                    }
                }
            }, content: {
                validators: {
                    notEmpty: {
                        message: '维保内容不能为空',
                    },
                }
            }, species: {
                validators: {
                    notEmpty: {
                        message: '维保种类不能为空',
                    },
                }
            }, timeCost: {
                validators: {
                    notEmpty: {
                        message: '实施用时不能为空',
                    }, regexp: {
                        regexp: /^(([0-9])|([1-9]([0-9]+)))(.[0-9]{1})?$/,
                        message: '只能是一位小数的正小数'
                    },
                }
            },
            maintenanceTime: {
                validators: {
                    notEmpty: {
                        message: '维保时间不能为空',
                    },
                }
            },
        }
    }).on('success.form.bv', function (e) {
        showLoading("正在提交中");
        //防止表单提交
        e.preventDefault();
        //获取表单实例
        var $form = $(e.target);
        //获取BootstrapValidator实例
        jQuery.support.cors = true;
        var bv = $form.data('bootstrapValidator');
        var formdata = new FormData($("#addInfoForm")[0]);
        compressPicture($('#add_file_hide').prop('files')[0], 100, 100, 0.75, function (blob) {
            if (!isNull(blob)) {
                formdata.append("thumbnail", blob)
            }
            ////使用Ajax提交表单数据
            $.ajax({
                url: "../maintenance/saveOrUpdateMaintenance",
                type: 'POST',
                data: formdata,
                contentType: false,
                processData: false,
                beforeSend: function (xhr) {
                    xhr.setRequestHeader('token', sessionStorage.getItem("token"));
                },
                success: function (data) {
                    if (data.code == 200) {
                        hideLoading();
                        myAlert("提示", "保存成功", function () {
                            loadMaintenanceData(toPage);
                            return;
                        })
                    }
                    hideLoading();
                    myAlert("提示", data.message, function () {
                        $('[type="submit"]').removeAttr("disabled");
                    })
                },
                error: function (data) {
                    hideLoading();
                    myAlert("提示", "保存失败", function () {
                        $('[type="submit"]').removeAttr("disabled");
                    })
                }
            });
        });
    }).on('error.form.bv', function (e) { //点击提交验证失败之后
        $('[type="submit"]').removeAttr("disabled");
    });
}

function loadMaintenanceData() {
    loadMaintenanceListTwo();
    loadMaintenanceCount();
}

function loadMaintenanceListTwo(_pageIndex) {
    $('#addInfoModal').modal('hide');
    showLoading(LOADING);
    let pageIndex = parseInt(_pageIndex ? _pageIndex : '1');
    toPage = pageIndex;
    getJson("/maintenance/getMaintenanceInfoByParam", {
        eId: $('#company-list').val(),
        dateTime: $('#searchTimeBegin').val(),
        type: 1,
        name: $('#name').val(),
        deviceType: $('#deviceType-select').val(),
        pageIndex: pageIndex,
        pageSize: pageSize
    }, 'GET', function (result) {
        if (result['code'] == 200) {
            let data = result['payload']['data'];
            setPage($('#page'), pageIndex, result['payload']['pages'], result['payload']['total'], function (num) {
                loadMaintenanceListTwo(num);
            });
            let order = 1 + pageSize * (pageIndex - 1);
            for (let item of data) {
                item['order'] = order++;
            }
            buildTable($('#maintenance_List'), titleTo, labelTo, data, function (td, label, item) {
                switch (label) {
                    case "content":
                        $(td).empty();
                        if (item['content'] && item['content'].length) {
                            let div = createElement("div", $(td), item['content'], null);
                            $(div).addClass('text-truncate').addClass('more-tooltip');
                            $(div).attr('data-toggle', 'tooltip');
                            $(div).attr('title', item['content']);
                        } else {
                            $(td).text(item['content']);
                        }
                        break;
                    case "materialList":
                        $(td).empty();
                        if (item['materialList'] && item['materialList'].length) {
                            let div = createElement("div", $(td), item['materialList'], null);
                            $(div).addClass('text-truncate').addClass('more-tooltip');
                            $(div).attr('data-toggle', 'tooltip');
                            $(div).attr('title', item['materialList']);
                        } else {
                            $(td).text(item['materialList']);
                        }
                        break;
                    case "planningTime":
                        $(td).empty();
                        if (item['species'] == 1) {
                            let lastMaintenance = parseInt(item['lastMaintenanceTime']);
                            let cycle = parseInt(item['maintenanceCycle']);
                            /*下次维保时间*/
                            let nextMaintenance = lastMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
                            $(td).text(getDate(nextMaintenance).date());
                        }
                        break;
                    case "species":
                        $(td).empty();
                        let tem = '';
                        switch (item['species']) {
                            case 1:
                                tem = '定保';
                                break;
                            case 2:
                                tem = '一级保养';
                                break;
                            case 3:
                                tem = '二级保养';
                                break;
                            case 4:
                                tem = '预防性维修';
                                break;
                            case 5:
                                tem = '故障维修';
                                break;
                        }
                        $(td).text(tem);
                        break;
                    case 'maintenanceTime':
                        $(td).empty();
                        $(td).text(getDate(item['maintenanceTime']).datetime());
                        break;
                    case 'image':
                        $(td).empty();
                        if (!isNull(item['image'])) {
                            let img = createElement('img', td);
                            $(img).addClass('img-preview');
                            $(img).attr('src', fileUrl + concatMinImgUrl(item['image']));
                            $(img).attr('data-origin', fileUrl + item['image']);
                        }
                        break;
                    case 'opera':
                        let edit = createElement('a', td);
                        $(edit).addClass('font-p24');
                        $(edit).attr('href', '##');
                        $(edit).click(function () {
                            editInfo(item['id']);
                        });
                        let del = createElement('a', td);
                        $(del).addClass('font-p24').addClass('delete-option-btn').addClass('ml-2');
                        $(del).attr('href', '##');
                        $(del).click(function () {
                            deleteInfo(item['id']);
                        });
                        let editIcon = createElement('i', edit);
                        $(editIcon).addClass('iconfont').addClass('icon-bianji-');
                        let delIcon = createElement('i', del);
                        $(delIcon).addClass('iconfont').addClass('icon-shanchuicon');
                        break;
                }
            })
            $('.more-tooltip').tooltip();
        }
        hideLoading();
    })
}

function loadMaintenanceCount() {
    getJson("/maintenance/countMaintenanceInfoByParam", {
            eId: $('#company-list').val(),
            dateTime: $('#searchTimeBegin').val(),
            type: 1,
            name: $('#name').val(),
            deviceType: $('#deviceType-select').val(),
        }, 'GET', function (data) {
            var payload = data['payload']['data'];
            /*定保*/
            var dingBao = 0;
            /*故障维修*/
            var malfunction = 0;
            /*预防*/
            var prevention = 0;
            /*二级*/
            var LevelT = 0;
            /*一级*/
            var LevelO = 0;
            payload.map(function (item) {
                switch (item['species']) {
                    case 1:
                        dingBao += item['count'];
                        break;
                    case 2:
                        LevelO += item['count'];
                        break;
                    case 3:
                        LevelT += item['count'];
                        break;
                    case 4:
                        prevention += item['count'];
                        break;
                    case 5:
                        malfunction += item['count'];
                        break;
                }
            });
            chart_pie2.setOption({
                series: [{
                    data: [
                        {value: dingBao, name: '定保'},
                        {value: LevelO, name: '一级保养'},
                        {value: LevelT, name: '二级保养'},
                        {value: prevention, name: '预防性维修'},
                        {value: malfunction, name: '故障维修'}
                    ]
                }]
            });
            $('#record_count').text(dingBao + malfunction + prevention + LevelT + LevelO);
        }
    )
}

$("#page").paging({
    pageNo: 1,
    totalPage: 1,
    totalSize: 1,
    callback: function (num) {
    }
});

laydate.render({
    elem: '#validationCustom03',
    type: 'datetime',
    done: function (value) {
        $('#validationCustom03').val(value);
        $('#validationCustom03').trigger('input');
    }
});
laydate.render({
    elem: '#searchTimeBegin',
    range: '~'
});
laydate.render({
    elem: '#searchTimeEnd',
});

/*添加*/
function addInfo() {
    $('#method-id').val(0);
    $('#addInfoForm')[0].reset();//清空表单
    $("#addInfoForm").data('bootstrapValidator').destroy();
    $('#addInfoForm').data('bootstrapValidator', null);
    formValidation();
    $('#validationCustom01').removeAttr("readonly");
    $('#img_load_area').attr('src', '../customize/images/icon/image-upload.png')
    $('#modal_title').text('添加维保记录');
    $('#addInfoModal').modal();
}

/*修改信息*/
function editInfo(e) {
    $('#addInfoForm')[0].reset();//清空表单
    $("#addInfoForm").data('bootstrapValidator').destroy();
    $('#addInfoForm').data('bootstrapValidator', null);
    formValidation();
    $('#validationCustom01').attr("readonly", "readonly");
    $('#id-id').val(e);
    $('#method-id').val(1);
    getJson("/maintenance/getMaintenanceBayId", {"id": e}, 'GET', function (result) {
        $('#validationCustom01').val(result.sn);
        $('#validationCustom02').val(result.content);
        $('#validationCustom03').val(getDate(result.maintenanceTime).datetime());
        $('#deviceName_id').val(result.name);
        $('#validationCustom05').val(result.timeCost);
        $('#validationCustom06').val(result['implementer']);
        $('#validationCustom07').val(result['checkVerifier']);
        $('#validationCustom08').val(result['materialList']);
        if (isNull(result.image)) {
            $('#img_load_area').attr('src', '../customize/images/icon/image-upload.png')
        } else {
            $('#img_load_area').attr('src', fileUrl + result.image)
        }
        $('#modal_title').text('修改维保记录');
        $('#addInfoModal').modal();
    })
}

/*删除信息*/
function deleteInfo(e) {
    myConfirm("提示", "是否要删除此信息", function (res) {
        if (res) {
            getJson("/maintenance/deleteMaintenance", {"id": e}, 'GET', function (result) {
                if (result.code == 200) {
                    myAlert("提示", "删除成功", function () {
                        loadMaintenanceData(toPage);
                        return;
                    });
                } else {
                    myAlert("提示", result.message);
                }
            })
        }
    })
}

/*选择的图片加载到预览区*/
$('#add_file_hide').change(function (e) {
    if (this.files[0].size / 1024 / 1024 > 10) {
        myAlert("提示", "选择的图片不能超过10M");
        return;
    }
    var _URL = window.URL || window.webkitURL;
    var file, img;
    if ((file = this.files[0])) {
        img = new Image();
        img.onload = function () {
            $('#img_load_area').attr('src', this.src);
        };
        img.src = _URL.createObjectURL(file);
    }
});

/*

function loadMaintenanceList() {
    showLoading(LOADING);
    var param = $('#param_id').val();
    getJson('/maintenance/list', null, 'GET', function (data) {
        var group1 = [];
        var group2 = [];
        var group3 = [];
        var group4 = [];
        var group5 = [];
        var month = getDate(new Date()).month();
        var date = getDate(new Date()).date();
        var year = getDate(new Date()).year();
        var list = data['payload']['data'];
        var extension = data['payload']['extension'];
        list.map(function (item) {
            if (!item['lastMaintenance']) {
                item['lastMaintenance'] = item['createTime'];
            }
            /!*上次维保时间*!/
            var lastMaintenance = parseInt(item['lastMaintenance']);
            /!*维保周期转换为时间戳*!/
            var cycle = parseInt(item['cycle']);
            /!*下次维保时间*!/
            item['nextMaintenance'] = lastMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            var nextMaintenance = lastMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            /!*已维保*!/
            if (getDate(lastMaintenance).year() == year && getDate(lastMaintenance).month() == month) {
                group1.push(item);
            } else if (getDate(nextMaintenance).year() == year && getDate(nextMaintenance).month() == month) {
                /!*应维保*!/
                if (getDate(nextMaintenance).date() == date) {
                    group2.push(item);
                } else   /!*待维保*!/
                if (contrastTime(getDate(nextMaintenance).date(), date)) {
                    group3.push(item);
                }
            }
            /!*已延期*!/
            if (contrastTime(date, getDate(nextMaintenance).date())) {
                group4.push(item);
            }
        });
        extension.map(function (item) {
            if (!item['lastMaintenance']) {
                item['lastMaintenance'] = item['createTime'];
            }
            /!*维保周期转换为时间戳*!/
            var cycle = parseInt(item['cycle']);
            var lastMaintenance = parseInt(item['lastMaintenance']);
            item['nextMaintenance'] = lastMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            group5.push(item);
        });

        switch (param) {
            case '1':
                buildData(group1, '已维保', 'build');
                break;
            case '2':
                buildData(group3, '待维保', 'build');
                break;
            case '3':
                buildData(group4, '已延期', 'build');
                break;
            case '4':
                buildData(group2, '应维保', 'build');
                break;
            case '5':
                buildData(group5, '延期保养', 'build');
                break;
            case '0':
                buildData(group4, '已延期', 'build');
                buildData(group2, '应维保', 'append');
                buildData(group1, '已维保', 'append');
                buildData(group3, '待维保', 'append');
                buildData(group5, '延期保养', 'append');
                break;
        }
        if (list.length > 0) {
            $('#wait_List .wsj').remove();
        }
        var count = [
            {name: '应维保', value: group2.length},
            {name: '已维保', value: group1.length},
            {name: '待维保', value: group3.length},
            {name: '已延期', value: group4.length},
            {name: '延期保养', value: group5.length}
        ];
        $('#month_count').text(group1.length + group2.length + group3.length + group4.length);
        chart_pie1.setOption({
            series: [{
                data: count
            }]
        });
        hideLoading();
    });
}

function buildData(data, status, method) {
    for (var i = 1; i < data.length; i++) {
        for (var j = 0; j < i; j++) {
            if (data[i]['nextMaintenance'] < data[j]['nextMaintenance']) {
                var temp = data[i];
                data[i] = data[j];
                data[j] = temp;
                temp = null;
            }
        }
    }
    if (method == 'build') {
        buildTable($('#wait_List'), maintenanceTitle, maintenanceLabel, data, function (td, label, item) {
            switch (label) {
                case 'cycle':
                    $(td).text(item[label] + '天');
                    break;
                case 'lastMaintenance':
                    $(td).text(getDate(item[label]).date());
                    break;
                case 'maintenanceDate':
                    $(td).text(getDate(item['nextMaintenance']).date());
                    break;
                case 'nextMaintenance':
                    $(td).text(getDate(parseInt(item['nextMaintenance']) + parseInt(item['cycle'] * 24 * 60 * 60 * 1000)).date());
                    break;
                case 'status':
                    $(td).text(status);
                    break;
            }
        });
    }
    if (method == 'append') {
        // 追加数据
        appendTableData($('#wait_List'), maintenanceLabel, data, function (td, label, item) {
            switch (label) {
                case 'cycle':
                    $(td).text(item[label] + '天');
                    break;
                case 'lastMaintenance':
                    $(td).text(getDate(item[label]).date());
                    break;
                case 'maintenanceDate':
                    $(td).text(getDate(item['nextMaintenance']).date());
                    break;
                case 'nextMaintenance':
                    $(td).text(getDate(parseInt(item['nextMaintenance']) + parseInt(item['cycle'] * 24 * 60 * 60 * 1000)).date());
                    //$(td).addClass('notify');
                    break;
                case 'status':
                    $(td).text(status);
                    if (status == '已延期') {
                        $(td).addClass('text-fault');//已延期标颜色，其他状态不标
                    }
                    break;
            }
        });
    }

}*/


function loadMaintenanceList() {
    showLoading(LOADING);
    var param = $('#param_id').val();
    getJson('/maintenance/list', null, 'GET', function (data) {
        var group1 = [];
        var group2 = [];
        var group3 = [];
        var group4 = [];
        var group5 = [];
        var month = getDate(new Date()).month();
        var date = getDate(new Date()).date();
        var year = getDate(new Date()).year();
        var list = data['payload']['data'];
        var extension = data['payload']['extension'];
        list.map(function (item) {
            if (!item['lastMaintenance']) {
                item['lastMaintenance'] = item['createTime'];
            }
            /*本次维保时间*/
            var toMaintenance = parseInt(item['lastMaintenance']);
            /*维保周期转换为时间戳*/
            var cycle = parseInt(item['cycle']);
            /*应维保时间 本次维保时间加周期*/
            item['maintenanceDate'] = toMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            item['nextMaintenance'] = toMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            /*应维保时间  本次维保时间加周期*/
            var maintenanceDate = toMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            if (getDate(maintenanceDate).year() === year && getDate(maintenanceDate).month() === month) {
                /*应维保*/
                if (getDate(maintenanceDate).date() === date) {
                    group2.push(item);
                } else   /*待维保*/
                if (contrastTime(getDate(maintenanceDate).date(), date)) {
                    group3.push(item);
                }
            }
            /*已延期*/
            if (contrastTime(date, getDate(maintenanceDate).date())) {
                group4.push(item);
            }
            /*已维保*/
            if (getDate(toMaintenance).year() === year && getDate(toMaintenance).month() === month) {
                if (!item['previousMaintenance']) {
                    item['previousMaintenance'] = item['createTime'];
                }
                /*上次维保时间*/
                var previousMaintenance = parseInt(item['previousMaintenance']);
                /*应维保日期*/
                item['maintenanceDate'] = previousMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
                if (getDate(item['maintenanceDate']).year() === year && getDate(item['maintenanceDate']).month() === month) {
                    group1.push(item);
                }
                item['nextMaintenance'] = toMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            }

        });
        extension.map(function (item) {
            if (!item['lastMaintenance']) {
                item['lastMaintenance'] = item['createTime'];
            }
            /*维保周期转换为时间戳*/
            var cycle = parseInt(item['cycle']);
            var lastMaintenance = parseInt(item['lastMaintenance']);
            item['maintenanceDate'] = lastMaintenance + parseInt(cycle * 24 * 60 * 60 * 1000);
            item['nextMaintenance'] = item['maintenanceDate'] + parseInt(cycle * 24 * 60 * 60 * 1000);
            group5.push(item);
        });
        switch (param) {
            case '1':
                buildData(group1, '已维保', 'build');
                break;
            case '2':
                buildData(group3, '待维保', 'build');
                break;
            case '3':
                buildData(group4, '已延期', 'build');
                break;
            case '4':
                buildData(group2, '应维保', 'build');
                break;
            case '5':
                buildData(group5, '延期保养', 'build');
                break;
            case '0':
                buildData(group4, '已延期', 'build');
                buildData(group2, '应维保', 'append');
                buildData(group1, '已维保', 'append');
                buildData(group3, '待维保', 'append');
                buildData(group5, '延期保养', 'append');
                break;
        }
        if (list.length > 0) {
            $('#wait_List .wsj').remove();
        }
        var count = [
            {name: '应维保', value: group2.length},
            {name: '已维保', value: group1.length},
            {name: '待维保', value: group3.length},
            {name: '已延期', value: group4.length},
            {name: '延期保养', value: group5.length}
        ];
        chart_pie1.setOption({
            series: [{
                data: count
            }]
        });
        $('#month_count').text(group1.length + group2.length + group3.length + group4.length);
        hideLoading();
    });
}

function buildData(data, status, method) {
    for (var i = 1; i < data.length; i++) {
        for (var j = 0; j < i; j++) {
            if (data[i]['nextMaintenance'] < data[j]['nextMaintenance']) {
                var temp = data[i];
                data[i] = data[j];
                data[j] = temp;
                temp = null;
            }
        }
    }
    if (method == 'build') {
        buildTable($('#wait_List'), maintenanceTitle, maintenanceLabel, data, function (td, label, item) {
            switch (label) {
                case 'cycle':
                    $(td).text(item[label] + '天');
                    break;
                case 'lastMaintenance':
                    $(td).text(getDate(item[label]).date());
                    break;
                case 'maintenanceDate':
                    $(td).text(getDate(item[label]).date());
                    break;
                case 'nextMaintenance':
                    $(td).text(getDate(item[label]).date());
                    break;
                case 'status':
                    $(td).text(status);
                    break;
            }
        });
    }
    if (method == 'append') {
        // 追加数据
        appendTableData($('#wait_List'), maintenanceLabel, data, function (td, label, item) {
            switch (label) {
                case 'cycle':
                    $(td).text(item[label] + '天');
                    break;
                case 'lastMaintenance':
                    $(td).text(getDate(item[label]).date());
                    break;
                case 'maintenanceDate':
                    $(td).text(getDate(item[label]).date());
                    break;
                case 'nextMaintenance':
                    $(td).text(getDate(item[label]).date());
                    break;
                case 'status':
                    $(td).text(status);
                    if (status == '已延期') {
                        $(td).addClass('text-fault');//已延期标颜色，其他状态不标
                    }
                    break;
            }
        });
    }

}